public Response ImportToPurchaseOrder(string token, [FromBody] MenuOrderHead param) { Response response = new Response(); if (string.IsNullOrEmpty(token) || !token.Equals(_token)) { response.code = "404"; response.message = "Invild token"; } else { int result = PurchaseOrderHelper.ImportToPurchaseOrder(param); if (result == 0) { response.code = "500"; response.message = "No Data"; } else { response.code = "200"; response.content = result; } } return(response); }
/// <summary> /// 导出 /// </summary> private void btnExportData_Click(object sender, System.EventArgs e) { try { if (Request["RadioGroup"] == null || Request["RadioGroup"].Length < 0) { this.ShowMsg("请选择要导出数据", false); return; } PurchaseOrderItemQuery purchaseOrderItemQuery = new PurchaseOrderItemQuery { PageSize = 9999999, PageIndex = 1, SortOrder = SortAction.Desc, SortBy = "CreateTime", POId = int.Parse(Request["RadioGroup"].ToString()) }; DbQueryResult purchaseOrder = PurchaseOrderHelper.GetPurchaseOrderItemList(purchaseOrderItemQuery); System.Data.DataTable dtPO = purchaseOrder.Data as DataTable; if (dtPO != null && dtPO.Rows.Count > 0) { GetExcelReport(dtPO, Globals.MapPath("/config/ProductListTemplate.xls")); } else { this.ShowMsg("未查询到数据", false); } } catch (Exception ex) { this.ShowMsg("导出失败" + ex.Message, false); } }
private void btnExportItem_Click(object sender, System.EventArgs e) { try { if (Request["RadioGroup"] == null || Request["RadioGroup"].Length < 0) { this.ShowMsg("请选择要导出数据", false); return; } DataSet ds = PurchaseOrderHelper.GetPurchaseOrderExportItem(int.Parse(Request["RadioGroup"].ToString())); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { GetExcelReportItem(ds.Tables[0], "POImportAndExport"); } else { this.ShowMsg("未查询到数据", false); } } catch (Exception ex) { this.ShowMsg("导出失败" + ex.Message, false); } }
protected void btnAdd_Click(object sender, System.EventArgs e) { string text = base.Request.Form["CheckBoxGroup"]; if (string.IsNullOrEmpty(text)) { this.ShowMsg("请选择一件商品!", false); return; } var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } if (PurchaseOrderHelper.POAddProducts(this.POId, text, member.UserId)) { this.CloseWindow(); return; } else { this.ShowMsg("该单状态不允许操作或您无权操作该单或已存在该商品", false); } }
/// <summary> /// 初始化绑定商品数据 /// </summary> /// <param name="sortBy"></param> /// <param name="sortOrder"></param> private void BindProducts(string sortBy, SortAction sortOrder) { this.LoadParameters(); PurchaseOrderItemQuery purchaseOrderItemQuery = new PurchaseOrderItemQuery { POId = this.POId, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = sortOrder, SortBy = sortBy, ProductName = this.productsName, BarCode = this.barCode, }; Globals.EntityCoding(purchaseOrderItemQuery, true); DbQueryResult purchaseOrder = PurchaseOrderHelper.GetPurchaseOrderItemList(purchaseOrderItemQuery); this.rpPOItem.DataSource = purchaseOrder.Data; this.rpPOItem.DataBind(); //获取采购单总数量,采购单总金额(最上面或者最底下加整个明细的加总) DataSet ds = PurchaseOrderHelper.GetPOTotalQuyAndAmount(this.POId); //ExpectQuantity,OriginalCurrencyTotalPrice,TotalSalePrice if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { lblTotal.Text = string.Format("合计:采购单总数量:{0}; 采购单原币总金额:{1}; 采购单销售总金额:{2};", ds.Tables[0].Rows[0][0], ds.Tables[0].Rows[0][1], ds.Tables[0].Rows[0][2]); } this.pager1.TotalRecords = (this.pager.TotalRecords = purchaseOrder.TotalRecords); }
/// <summary> /// 编辑时绑定数据 /// </summary> private void DataBind(string Id) { DataSet dsPurchaseOrderItem = PurchaseOrderHelper.GetPurchaseOrderItem("Id=" + Id); if (dsPurchaseOrderItem != null && dsPurchaseOrderItem.Tables.Count > 0 && dsPurchaseOrderItem.Tables[0].Rows.Count > 0) { DataRow dr = dsPurchaseOrderItem.Tables[0].Rows[0]; txtBoxBarCode.Text = dr["BoxBarCode"].ToString(); txtExpectQuantity.Text = dr["ExpectQuantity"].ToString(); //txtPracticalQuantity.Text = dr["PracticalQuantity"].ToString(); ddlIsSample.SelectedValue = dr["IsSample"].ToString() == "True" ? "1" : "0"; if (dr["ManufactureDate"] != null && dr["ManufactureDate"].ToString() != "") { calendarManufactureDate.Text = Convert.ToDateTime(dr["ManufactureDate"]).ToString("yyyy-MM-dd"); } if (dr["EffectiveDate"] != null && dr["EffectiveDate"].ToString() != "") { calendarEffectiveDate.Text = Convert.ToDateTime(dr["EffectiveDate"]).ToString("yyyy-MM-dd");; } txtBatchNumber.Text = dr["BatchNumber"].ToString(); txtRoughWeight.Text = dr["RoughWeight"].ToString(); txtNetWeight.Text = dr["NetWeight"].ToString(); txtOriginalCurrencyPrice.Text = dr["OriginalCurrencyPrice"].ToString() != "" ? decimal.Parse(dr["OriginalCurrencyPrice"].ToString()).ToString("F2") : ""; ddlCurrency.SelectedValue = dr["CurrencyId"].ToString(); txtRate.Text = dr["Rate"].ToString(); hidRate.Value = dr["Rate"].ToString(); txtCostPrice.Text = dr["CostPrice"].ToString() != "" ? decimal.Parse(dr["CostPrice"].ToString()).ToString("F2") : ""; txtSalePrice.Text = dr["SalePrice"].ToString() != "" ? decimal.Parse(dr["SalePrice"].ToString()).ToString("F2") : ""; txtCartonSize.Text = dr["CartonSize"].ToString(); txtCartonMeasure.Text = dr["CartonMeasure"].ToString(); txtCases.Text = dr["Cases"].ToString(); } }
public Response GetPurchaseOrderLine(string token, [FromBody] PurchaseOrderHead param) { Response response = new Response(); if (string.IsNullOrEmpty(token) || !token.Equals(_token)) { response.code = "404"; response.message = "Invild token"; } else { List <PurchaseOrderLine> lstPOL = PurchaseOrderHelper.GetPurchaseOrderLine(param); if (lstPOL == null || lstPOL.Count == 0) { response.code = "500"; response.message = "No Data"; } else { response.code = "200"; response.content = lstPOL; } } return(response); }
/// <summary> /// 绑定币别 /// </summary> private void DataBindCurrency() { DataSet dsBaseCurrency = PurchaseOrderHelper.GetBaseCurrency(); ddlCurrency.DataTextField = "Name_CN"; ddlCurrency.DataValueField = "ID"; ddlCurrency.DataSource = dsBaseCurrency; ddlCurrency.DataBind(); }
private void btnImportItem_Click(object sender, System.EventArgs e) { try { if (Request["RadioGroup"] == null || Request["RadioGroup"].Length < 0) { this.ShowMsg("请选择要导入数据", false); return; } var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } //是否有权限,是否自己的,是否在可变更状态 ManagerHelper.CheckPrivilege(Privilege.POAdd); DataSet ds = PurchaseOrderHelper.GetPurchaseOrder(1, string.Format("IsDel=0 and id={0} AND POStatus=0 and CreateUserId={1}", Request["RadioGroup"].ToString(), member.UserId)); if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { this.ShowMsg("导入失败,请检查您是否有权限,或订单状态是否允许修改", false); return; } if (!this.fileUploader.HasFile) { this.ShowMsg("请先选择一个数据文件", false); return; } if (this.fileUploader.PostedFile.ContentLength == 0 || this.fileUploader.PostedFile.ContentType != "application/vnd.ms-excel") { this.ShowMsg("请上传正确的数据文件", false); return; } if (!Directory.Exists(this._dataPath)) { Directory.CreateDirectory(this._dataPath); } string fileName = System.IO.Path.GetFileName(this.fileUploader.PostedFile.FileName); this.fileUploader.PostedFile.SaveAs(System.IO.Path.Combine(this._dataPath, fileName)); DataTable dt = ExcelDataSource(this._dataPath + "/" + fileName); if (dt != null && dt.Rows.Count > 0) { SavePOItem(int.Parse(Request["RadioGroup"].ToString()), dt, member.UserId); } else { this.ShowMsg("导入文档无数据", false); } } catch (Exception ex) { this.ShowMsg("导入失败" + ex.Message, false); } }
public string GetPOCDInfo(string formId) { string str = ""; if (formId.Length != 18) { str = "{\"message\":\"参数长度不对\"}"; } else { str = Newtonsoft.Json.JsonConvert.SerializeObject(PurchaseOrderHelper.GetPOCDInfo(formId)); } return(str); }
/// <summary> /// 绑定数据 /// </summary> public override void DataBind() { this.Items.Clear(); this.Items.Add(new ListItem(this.NullToDisplay, string.Empty)); DataTable dtCountry = PurchaseOrderHelper.GetBaseEnumDictList("GetTax"); if (dtCountry != null && dtCountry.Rows.Count > 0) { for (int i = 0; i < dtCountry.Rows.Count; i++) { string itemValue = dtCountry.Rows[i]["DictValue"].ToString(); ListItem item = new ListItem(Globals.HtmlDecode(dtCountry.Rows[i]["DictName"].ToString()), itemValue); this.Items.Add(item); } } }
/// <summary> /// /// </summary> /// <param name="context"></param> public void GetCI_Status(System.Web.HttpContext context) { string status = context.Request["status"].ToLower(); string id = context.Request["id"].ToLower(); string Remark = context.Request["Remark"]; string UserId = context.Request["UserId"].ToLower(); string Username = context.Request["Username"]; //执行更改 if (PurchaseOrderHelper.SetCIStatus(id, status, Remark, int.Parse(UserId), Username)) { this.message = "{\"success\":\"YES\",\"MSG\":\"操作成功\"}"; } else { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败,请检查您是否有权限,如无问题请刷新后重试。\"}"; } }
/// <summary> /// PO申报发送响应 /// </summary> /// <param name="context"></param> private void PODeclareResponse(System.Web.HttpContext context) { string id = context.Request["ID"]; string json = context.Request["json"]; POJsonInfo POJsonInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <POJsonInfo>(json); //ErrorLogs("json: " + json); //ErrorLogs("formId: " + header.formId); POJsonInfo.POId = id; POJsonInfo.contractNo = PurchaseOrderHelper.UP_GetNewRecordNo(4, "D", DateTime.Now.ToString("yyMMdd")); PurchaseOrderHelper.SavePOcustomsDeclaration(POJsonInfo); //if (!PurchaseOrderHelper.SavePOcustomsDeclaration(header)) //{ // this.message = "{\"success\":\"NO\",\"MSG\":\"参数获取失败\"}"; //} }
private DbQueryResult GetData(string sortBy, SortAction sortOrder) { this.LoadParameters(); PODeclareListQuery PODeclareListQuery = new PODeclareListQuery { PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = sortOrder, SortBy = sortBy, StartDate = this.startDate, EndDate = this.endDate, //POCDStatus = this.POCDStatus, fromID = this.fromID, PONumber = this.poNumber }; Globals.EntityCoding(PODeclareListQuery, true); return(PurchaseOrderHelper.GetPODeclareList(PODeclareListQuery)); }
protected void rpPO_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } if (e.CommandName == "del") { int num = System.Convert.ToInt32(e.CommandArgument); if (!PurchaseOrderHelper.Deletet(num, member.UserId)) { this.ShowMsg("该单状态不允许操作或您无权操作该单", false); return; } this.ReloadProductOnSales(true); } }
public string SetPOCDStatus(string formId, int POStatus, string PORemark, string CommonNum) { string str = ""; if (formId.Length != 18) { str = "{\"message\":\"参数长度不对\"}"; } else { Encoding utf8 = Encoding.UTF8; if (PurchaseOrderHelper.SetPOCDStatus(formId, POStatus, HttpUtility.UrlDecode(PORemark, utf8), CommonNum)) { str = "{\"message\":\"更新成功\"}"; } else { str = "{\"message\":\"更新失败\"}"; } } return(str); }
/// <summary> /// 获取报关单主体列表 /// </summary> /// <param name="context"></param> public void POCDPurchaseOrderBodyLj(System.Web.HttpContext context) { string Id = context.Request["Id"].ToString(); if (!string.IsNullOrEmpty(Id)) { int bodyId = int.Parse(Id); DataTable dt = PurchaseOrderHelper.GetPOCDPurchaseOrderBodyLj(bodyId); if (dt != null && dt.Rows.Count > 0) { this.message = Newtonsoft.Json.JsonConvert.SerializeObject(dt); } else { this.message = "{\"success\":\"NO\",\"MSG\":\"未查询到数据\"}"; } } else { this.message = "{\"success\":\"NO\",\"MSG\":\"参数获取失败\"}"; } }
private DbQueryResult GetData(string sortBy, SortAction sortOrder) { this.LoadParameters(); PurchaseOrderQuery purchaseOrderQuery = new PurchaseOrderQuery { PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = sortOrder, SortBy = sortBy, StartDate = this.startDate, EndDate = this.endDate, PONumber = this.poNumber, SupplierId = this.supplierId, POStatus = this.Status, HSInOut = this.hsInOut, QPStatus = this.QPStatus, CIStatus = this.CIStatus }; Globals.EntityCoding(purchaseOrderQuery, true); return(PurchaseOrderHelper.GetPurchaseOrderList(purchaseOrderQuery)); }
/// <summary> /// 编辑时绑定数据 /// </summary> private void DataBind(string Id) { IList <PurchaseOrderInfo> purchaseOrderInfo = PurchaseOrderHelper.GetPurchaseOrder("Id=" + Id); if (purchaseOrderInfo.Count > 0) { PurchaseOrderInfo po = purchaseOrderInfo[0]; ddlPOType.SelectedValue = po.POType.ToString(); txtPONumber.Text = po.PONumber; ddlSupplier.SelectedValue = po.SupplierId; ddlSupplier.Enabled = false; ddlSupplier.BackColor = System.Drawing.Color.Gray; if (po.ExpectedTime != null) { calendarExpectedTime.Text = Convert.ToDateTime(po.ExpectedTime).ToString("yyyy-MM-dd"); } if (po.DepartTime != null) { DepartTime.Text = Convert.ToDateTime(po.DepartTime).ToString("yyyy-MM-dd"); } if (po.ArrivalTime != null) { ArrivalTime.Text = Convert.ToDateTime(po.ArrivalTime).ToString("yyyy-MM-dd"); } ContainerNumber.Text = po.ContainerNumber; BillNo.Text = po.BillNo; hidCountry.Value = po.StartPort; hidCountryId.Value = po.StartPortID; txtCountry.Value = po.StartPort; if (po.EndPortID != null) { ddlEndPort.SelectedValue = po.EndPortID; } txtRemark.Text = po.Remark; } }
public string GetPOCDList(string formIDList) { string str = ""; string formID = ""; if (formIDList.Length == 0) { str = "{\"message\":\"参数长度不对\"}"; } else { POList list = new POList(); list = Newtonsoft.Json.JsonConvert.DeserializeObject <POList>(formIDList); foreach (formList formList in list.formIDList) { formID += "'" + formList.formId + "',"; //formID += formList.formId + ","; } formID = formID.TrimEnd(','); str = Newtonsoft.Json.JsonConvert.SerializeObject(PurchaseOrderHelper.GetPOCDList(formID)); } return(str); }
private void btnSave_Click(object sender, System.EventArgs e) { ManagerHelper.CheckPrivilege(Privilege.POAdd); if (this.ddlSupplier.SelectedValue == null || this.ddlSupplier.SelectedValue == 0) { this.ShowMsg("请选择供货商", false); return; } //if (calendarExpectedTime.SelectedDate < DateTime.Now) //{ // this.ShowMsg("预计到货时间必须大于当前时间", false); // return; //} var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } PurchaseOrderInfo purchaseOrderInfo = new PurchaseOrderInfo { POType = int.Parse(ddlPOType.SelectedValue), SupplierId = this.ddlSupplier.SelectedValue, ExpectedTime = calendarExpectedTime.SelectedDate, Remark = txtRemark.Text.Trim(), CreateUserId = member.UserId, DepartTime = DepartTime.SelectedDate, ArrivalTime = ArrivalTime.SelectedDate, ContainerNumber = ContainerNumber.Text.Trim(), BillNo = BillNo.Text.Trim(), StartPort = hidCountry.Value, StartPortID = hidCountryId.Value, EndPortID = ddlEndPort.SelectedValue, EndPort = ddlEndPort.SelectedItem.Text }; if (Request["Id"] != null && Request["Id"].ToString() != "") { int tmpId = 0; if (int.TryParse(this.Page.Request["Id"], out tmpId)) { purchaseOrderInfo.id = tmpId; if (PurchaseOrderHelper.EditPurchaseOrderInfo(purchaseOrderInfo)) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/POManage/POList.aspx"), true); return; } else { this.ShowMsg("该单状态不允许操作或您无权操作该单", false); } } else { this.ShowMsg("未知参数", false); } } else { if (PurchaseOrderHelper.AddPurchaseOrderInfo(purchaseOrderInfo)) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/POManage/POList.aspx"), true); return; } else { this.ShowMsg("添加失败,未知错误", false); } } }
/// <summary> /// 商检信息 /// </summary> /// <param name="context"></param> private void POCommodityInspectionInfo(System.Web.HttpContext context) { string id = context.Request["ID"]; DataTable head = PurchaseOrderHelper.POCommodityInspectionInfo(id); DataTable body = PurchaseOrderHelper.POCommodityInspectionInfoDes(id); if (head != null && head.Rows.Count > 0) { htb htb = new htb(); htb.orgCode = "051527056"; htb.agentName = "深圳市信捷网科技有限公司"; htb.customsCode = "5349/深圳前海湾保税港区口岸作业区"; htb.ciqCode = "470000/深圳局本部"; htb.supervisionCode = "5349/深圳前海湾保税港区口岸作业区"; htb.businessMode = "2"; htb.businessType = head.Rows[0]["businessType"].ToString(); //htb.businessType = "BA/桶"; htb.emsNo = "I440366003415001"; htb.storageTradeName = "深圳市信捷网科技有限公司"; htb.storageEbpName = "深圳市信捷网科技有限公司"; htb.logisticsName = "招商局保税物流有限公司"; htb.strIeDate = System.DateTime.Now.ToString("yyyy-MM-dd"); htb.storageEnd = System.DateTime.Now.ToString("yyyy-MM-dd"); htb.psType = "1"; htb.storagePortCode = head.Rows[0]["storagePortCode"].ToString(); htb.storageCusName = "深圳市信捷网科技有限公司"; htb.storageTrafMode = head.Rows[0]["storageTrafMode"].ToString(); htb.shipName = head.Rows[0]["shipName"].ToString(); htb.voyageNo = head.Rows[0]["voyageNo"].ToString(); htb.billNo = head.Rows[0]["billNo"].ToString(); htb.storageDestinationPort = "142/中国"; //htb.storageWrapType = head.Rows[0]["storageWrapType"].ToString(); if (head.Rows[0]["storageWrapType"].ToString() == "1/木箱") { htb.storageWrapType = "PN/厚木板"; } else if (head.Rows[0]["storageWrapType"].ToString() == "2/纸箱") { htb.storageWrapType = "CT/纸板箱"; } else if (head.Rows[0]["storageWrapType"].ToString() == "3/桶装") { htb.storageWrapType = "BA/桶"; } else if (head.Rows[0]["storageWrapType"].ToString() == "4/散装") { htb.storageWrapType = "BU/散装"; } else if (head.Rows[0]["storageWrapType"].ToString() == "5/拖盘") { htb.storageWrapType = "PU/拖盘包装"; } else if (head.Rows[0]["storageWrapType"].ToString() == "6/包") { htb.storageWrapType = "PK/包"; } else if (head.Rows[0]["storageWrapType"].ToString() == "7/其他") { htb.storageWrapType = "无"; } //htb.storageWrapType = "BA/桶"; htb.packNo = head.Rows[0]["packNo"].ToString(); htb.weight = head.Rows[0]["weight"].ToString(); htb.netWt = head.Rows[0]["netWt"].ToString(); htb.storageTradeMode = "1210/保税电商"; htb.storageTransMode = head.Rows[0]["storageTransMode"].ToString(); htb.note = ""; htb.select6 = "0"; if (body != null && body.Rows.Count > 0) { List <goods1> goodsList = new List <goods1>(); for (int i = 0; i < body.Rows.Count; i++) { goods1 goods = new goods1(); goods.itemNo = "ISHMSH" + body.Rows[i]["BarCode"].ToString(); goods.unit1 = "035/千克"; goods.price = body.Rows[i]["CostPrice"].ToString(); goods.ManufactureDate = Convert.ToDateTime(body.Rows[i]["ManufactureDate"]).ToString("yyyy-MM-dd"); goods.EffectiveDate = Convert.ToDateTime(body.Rows[i]["EffectiveDate"].ToString()).ToString("yyyy-MM-dd"); goods.qty1 = body.Rows[i]["RoughWeight"].ToString(); goods.BatchNumber = body.Rows[i]["BatchNumber"].ToString(); goods.DeclareNumber = body.Rows[i]["ExpectQuantity"].ToString(); goods.mergerNo = body.Rows[i]["num_no"].ToString(); //json.setInfo[i] = setInfo; goodsList.Add(goods); } htb.goods = goodsList; } this.message = Newtonsoft.Json.JsonConvert.SerializeObject(htb); } }
private void ExportPdf(System.Web.HttpContext context, string id) { this._PdfPath = "/storage/data/poToPdf/" + DateTime.Now.ToString("yyyyMM") + "/"; try { if (id == null || id.Length < 0) { this.message = "{\"success\":\"NO\",\"MSG\":\"无数据。\"}"; return; } DataSet ds = PurchaseOrderHelper.exportPurchaseOrder(int.Parse(id)); if (ds != null && ds.Tables.Count > 1 && ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { //判断目录是否存在,不存在则创建 string path = context.Request.MapPath(_PdfPath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string strHeaderID = ""; foreach (DataRow dr in ds.Tables[1].Rows) { DataRow[] drs = ds.Tables[0].Select("HeaderID=" + dr["HeaderID"]); if (drs.Length <= 0) { this.message = "{\"success\":\"NO\",\"MSG\":\"并非所有入库单都有正确返回数据。\"}"; //this.ShowMsg("并非所有入库单都有正确返回数据", false); return; } strHeaderID += dr["HeaderID"].ToString() + ","; DataSet dsData = new DataSet(); DataTable dt = ds.Tables[0].Clone(); dt.TableName = "dt"; foreach (DataRow item in drs) { dt.Rows.Add(item.ItemArray); } dsData.Tables.Add(dt); RptClass rc = new RptClass(); if (rc.ExportRpt(context.Request.MapPath("/Admin/rptTemplates/POInvoice.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POInvoice.pdf") != "导出成功") { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败。\"}"; //this.ShowMsg("操作失败", false); return; } if (rc.ExportRpt(context.Request.MapPath("/Admin/rptTemplates/POPacking.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POPacking.pdf") != "导出成功") { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败。\"}"; //this.ShowMsg("操作失败", false); return; } if (rc.ExportRpt(context.Request.MapPath("/Admin/rptTemplates/POContract.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POContract.pdf") != "导出成功") { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败。\"}"; //this.ShowMsg("操作失败", false); return; } } //插入数据库文件地址 if (PurchaseOrderHelper.SaveFilePath(_PdfPath, strHeaderID.TrimEnd(','))) { this.message = "{\"success\":\"NO\",\"MSG\":\"操作成功。\"}"; //this.ShowMsg("操作成功", true); } else { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败。\"}"; //this.ShowMsg("操作失败", false); } } else { this.message = "{\"success\":\"NO\",\"MSG\":\"未查询到数据,请检查报关单数据是否成功返回。\"}"; //this.ShowMsg("未查询到数据,请检查报关单数据是否成功返回。", false); } } catch (Exception ex) { this.message = "{\"success\":\"NO\",\"MSG\":\"失败: " + ex.Message + "。\"}"; //this.ShowMsg("失败:" + ex.Message, false); } }
/// <summary> /// PO申报发送请求 /// </summary> /// <param name="context"></param> private void PODeclareRequest(System.Web.HttpContext context) { string id = context.Request["ID"]; DataTable head = PurchaseOrderHelper.GetPODeclareJSON(id); DataTable body = PurchaseOrderHelper.GetPODeclareBodyJSON(id); if (head != null && head.Rows.Count > 0) { PODeclareJSON json = new PODeclareJSON(); json.applyCustoms = "深圳前海湾保税港区"; json.applyCustomsCode = "5349"; json.applyBusinessCode = "4403660034"; json.applyBusinessName = "深圳市信捷网科技有限公司"; json.applyort = head.Rows[0]["applyort"].ToString(); json.applyortCode = head.Rows[0]["applyortCode"].ToString(); json.transportType = head.Rows[0]["transportType"].ToString(); json.transportTypeCode = head.Rows[0]["transportTypeCode"].ToString(); json.companyCode = "4403660034"; json.companyName = "深圳市信捷网科技有限公司"; json.getGoodsBusinName = "深圳市信捷网科技有限公司"; json.businessType = head.Rows[0]["businessType"].ToString(); json.allQlt = head.Rows[0]["ExpectQuantity"].ToString(); json.wrapType = head.Rows[0]["wrapType"].ToString(); json.wrapTypeCode = head.Rows[0]["wrapTypeCode"].ToString(); json.superviseType = "保税电商"; json.superviseTypeCode = "1210"; json.tradeType = head.Rows[0]["tradeType"].ToString(); json.tradeTypeCode = head.Rows[0]["tradeTypeCode"].ToString(); json.Qty = head.Rows[0]["NetWeight"].ToString(); json.allQty = head.Rows[0]["RoughWeight"].ToString(); json.sendCountry = head.Rows[0]["StartPortID"].ToString(); json.sendCountryName = head.Rows[0]["StartPort"].ToString(); json.RecordCompanyName = "信捷网"; json.declarationType = "通关无纸化"; json.transname = head.Rows[0]["transname"].ToString(); json.loadport_no = head.Rows[0]["StartPortID"].ToString(); json.end_country_no = "44036"; json.cabin_no = head.Rows[0]["cabinno"].ToString(); if (body != null && body.Rows.Count > 0) { List <setInfo> setInfoList = new List <setInfo>(); for (int i = 0; i < body.Rows.Count; i++) { setInfo setInfo = new setInfo(); setInfo.mergeType = "手工"; setInfo.SkuId = body.Rows[i]["SkuId"].ToString(); setInfo.proLJNO = body.Rows[i]["LJNo"].ToString(); setInfo.HS_CODE = body.Rows[i]["HS_CODE"].ToString(); setInfo.ProductRegistrationNumber = body.Rows[i]["ProductRegistrationNumber"].ToString(); setInfo.HSProductName = body.Rows[i]["HSProductName"].ToString(); setInfo.applyNum = body.Rows[i]["ExpectQuantity"].ToString(); setInfo.AllPrice = body.Rows[i]["TotalCostPrice"].ToString(); setInfo.FriNum = body.Rows[i]["GrossWeight"].ToString(); setInfo.Country = body.Rows[i]["StandardCName"].ToString(); setInfo.CountryCode = body.Rows[i]["HSCode"].ToString(); setInfo.getTax = body.Rows[i]["getTax"].ToString(); setInfo.getTaxCode = body.Rows[i]["getTaxCode"].ToString(); setInfo.useType = body.Rows[i]["useType"].ToString(); setInfo.useTypeCode = body.Rows[i]["useTypeCode"].ToString(); setInfo.mergeRule = "10位规则"; setInfo.Price = body.Rows[i]["CostPrice"].ToString(); //json.setInfo[i] = setInfo; setInfoList.Add(setInfo); //json.setInfo[i].mergeRule = "手工"; //json.setInfo[i].SkuId = body.Rows[i]["SkuId"].ToString(); //json.setInfo[i].proLJNO = body.Rows[i]["LJNo"].ToString(); //json.setInfo[i].HS_CODE = body.Rows[i]["HS_CODE"].ToString(); //json.setInfo[i].ProductRegistrationNumber = body.Rows[i]["ProductRegistrationNumber"].ToString(); //json.setInfo[i].HSProductName = body.Rows[i]["HSProductName"].ToString(); //json.setInfo[i].applyNum = body.Rows[i]["ExpectQuantity"].ToString(); //json.setInfo[i].AllPrice = body.Rows[i]["TotalCostPrice"].ToString(); //json.setInfo[i].FriNum = body.Rows[i]["GrossWeight"].ToString(); //json.setInfo[i].Country = body.Rows[i]["StandardCName"].ToString(); //json.setInfo[i].CountryCode = body.Rows[i]["HSCode"].ToString(); //json.setInfo[i].getTax = body.Rows[i]["getTax"].ToString(); //json.setInfo[i].getTaxCode = body.Rows[i]["getTaxCode"].ToString(); //json.setInfo[i].useType = body.Rows[i]["useType"].ToString(); //json.setInfo[i].useTypeCode = body.Rows[i]["useTypeCode"].ToString(); //json.setInfo[i].mergeRule = "10位规则"; //json.setInfo[i].Price = body.Rows[i]["CostPrice"].ToString(); } json.setInfo = setInfoList; } this.message = Newtonsoft.Json.JsonConvert.SerializeObject(json); } }
private void btnExportPdf_Click(object sender, System.EventArgs e) { try { if (Request["RadioGroup"] == null || Request["RadioGroup"].Length < 0) { this.ShowMsg("请选择要导出数据", false); return; } DataSet ds = PurchaseOrderHelper.exportPurchaseOrder(int.Parse(Request["RadioGroup"].ToString())); if (ds != null && ds.Tables.Count > 1 && ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { //判断目录是否存在,不存在则创建 string path = Request.MapPath(_PdfPath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string strHeaderID = ""; foreach (DataRow dr in ds.Tables[1].Rows) { DataRow[] drs = ds.Tables[0].Select("HeaderID=" + dr["HeaderID"]); if (drs.Length <= 0) { this.ShowMsg("并非所有入库单都有正确返回数据", false); return; } strHeaderID += dr["HeaderID"].ToString() + ","; DataSet dsData = new DataSet(); DataTable dt = ds.Tables[0].Clone(); dt.TableName = "dt"; foreach (DataRow item in drs) { dt.Rows.Add(item.ItemArray); } dsData.Tables.Add(dt); RptClass rc = new RptClass(); if (rc.ExportRpt(Request.MapPath("/Admin/rptTemplates/POInvoice.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POInvoice.pdf") != "导出成功") { this.ShowMsg("操作失败", false); return; } if (rc.ExportRpt(Request.MapPath("/Admin/rptTemplates/POPacking.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POPacking.pdf") != "导出成功") { this.ShowMsg("操作失败", false); return; } if (rc.ExportRpt(Request.MapPath("/Admin/rptTemplates/POContract.rpt"), dsData, path + dsData.Tables[0].Rows[0]["ContractNo"] + "-POContract.pdf") != "导出成功") { this.ShowMsg("操作失败", false); return; } } //插入数据库文件地址 if (PurchaseOrderHelper.SaveFilePath(_PdfPath, strHeaderID.TrimEnd(','))) { this.ShowMsg("操作成功", true); } else { this.ShowMsg("操作失败", false); } } else { this.ShowMsg("未查询到数据,请检查报关单数据是否成功返回。", false); } } catch (Exception ex) { this.ShowMsg("失败:" + ex.Message, false); } }
public void GetPO_Status(System.Web.HttpContext context) { string status = context.Request["status"].ToLower(); string id = context.Request["id"].ToLower(); string Remark = context.Request["Remark"]; string UserId = context.Request["UserId"].ToLower(); string Username = context.Request["Username"]; if (!string.IsNullOrEmpty(status) && !string.IsNullOrEmpty(id)) { //招商权限(确认、取消确认)POZS和关务权限(除确认外其他)POGW //确认和取消确认只有招商有权限 if ((status == "0" || status == "1") && !CheckPrivilegeReturn(Username, Privilege.POZS)) { this.message = "{\"success\":\"NO\",\"MSG\":\"您无权操作,请联系管理员!\"}"; return; } if (status != "0" && status != "1" && !CheckPrivilegeReturn(Username, Privilege.POGW)) { this.message = "{\"success\":\"NO\",\"MSG\":\"您无权操作,请联系管理员!\"}"; return; } //申报、确认、删除、编辑在页面判断是否是自己的 if (status == "-1") { Remark = string.Format("{0}_{1}退回,时间:{2}", UserId, Username, DateTime.Now); } if (status == "0") { Remark = string.Format("{0}_{1}取消确认,时间:{2}", UserId, Username, DateTime.Now); } //确认时必须要有明细 if (status == "1" && !PurchaseOrderHelper.IsExistsPOItem(id)) { this.message = "{\"success\":\"NO\",\"MSG\":\"确认失败,请先添加采购订单明细!\"}"; return; } //如果是申报成功先调用WMS接口,成功后再修改 if (status == "7") { //1.获取发送需要的数据 DataSet ds = PurchaseOrderHelper.GetPurchaseOrderAndItem("po.id=" + id); if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ErrorLog.Write("执行了putASNData->PurchaseOrderHelper.GetPurchaseOrderAndItem返回查询结果:" + ds.Tables[0].Rows.Count); //构造数据 string skuData = this.CreatePOData(ds.Tables[0]); skuData = skuData.Replace("\n", "").Replace("\t", "").Replace("\r", "").Replace("+", "+"); //配置获取 HiConfiguration config = HiConfiguration.GetConfig(); XmlNode configSection = config.GetConfigSection("Ecdev/Jobs"); XmlNode configjob = configSection.SelectSingleNode("job[@name='OrderSendJob']"); string appkey = configjob.Attributes["appkey"].InnerText; // "test";//验签KEY string appSecret = configjob.Attributes["appSecret"].InnerText; //"1234567890";//秘钥存配置 string customerid = configjob.Attributes["client_customerid"].InnerText; // "XJW";//client_customerid string client_db = configjob.Attributes["client_db"].InnerText; // "WH01"; string apptoken = configjob.Attributes["apptoken"].InnerText; //"80AC1A3F-F949-492C-A024-7044B28C8025"; string url = configjob.Attributes["apiurl"].InnerText; //"http://192.168.1.120:8090/datahubWeb/FLUXWMSAPI/XJW";//apiurl //生成验签值 string tempdata = appSecret + skuData + appSecret; string md5tempdata = WMSHelper.MD5(tempdata); string basetempdata = WMSHelper.EncodingString(md5tempdata.ToLower(), System.Text.Encoding.UTF8); string sign = System.Web.HttpUtility.UrlEncode(basetempdata.ToUpper(), System.Text.Encoding.UTF8); //时间戳 string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//YYYY-MM-DD HH:MM:SS string postData = "method=putASNData&client_customerid=" + customerid + "&client_db=" + client_db + "&messageid=ASN&apptoken=" + apptoken + "&appkey=" + appkey + "&sign=" + sign + "×tamp=" + timestamp; //记录发送数据日志 ErrorLog.Write("执行了putASNData->发送数据:postData=" + postData + "&data=" + skuData); WMSHelper.SaveLog("putASNData", "postData=" + postData + "&data=" + skuData, "调用方法", "info", "out"); skuData = System.Web.HttpUtility.UrlEncode(skuData); //发送并接收回传数据 string sendResult = WMSHelper.PostData(url, postData + "&data=" + skuData); string tempResult = System.Web.HttpUtility.UrlDecode(sendResult); //保存接收消息 ErrorLog.Write("执行了putASNData->接收WMS消息:" + tempResult + "\n"); WMSHelper.SaveLog("putASNData", "", "返回结果:" + tempResult, "info", "in"); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(tempResult); XmlNode node = xmlDocument.SelectSingleNode("Response/return/returnCode"); XmlNode nodeFlag = xmlDocument.SelectSingleNode("Response/return/returnFlag"); XmlNode nodeDesc = xmlDocument.SelectSingleNode("Response/return/returnDesc"); if (node.InnerText != "0000") { //推送失败 this.message = "{\"success\":\"NO\",\"MSG\":\"采购订单传送WMS失败:" + nodeDesc.InnerText + "\"}"; return; } } else { this.message = "{\"success\":\"NO\",\"MSG\":\"获取采购订单数据失败\"}"; return; } } //执行更改 if (PurchaseOrderHelper.SetPOStatus(id, status, Remark, int.Parse(UserId), Username)) { this.message = "{\"success\":\"YES\",\"MSG\":\"操作成功\"}"; } else { this.message = "{\"success\":\"NO\",\"MSG\":\"操作失败,请检查您是否有权限,如无问题请刷新后重试。\"}"; } } else { this.message = "{\"success\":\"NO\",\"MSG\":\"参数获取失败\"}"; } }
private void DataBind(string Id) { IList <PODeclareInfo> PODeclareInfo = PurchaseOrderHelper.GetPODeclareInfo("Id=" + Id); if (PODeclareInfo.Count > 0) { PODeclareInfo po = PODeclareInfo[0]; txtPONumber.Text = po.PONumber; if (!string.IsNullOrEmpty(po.transname)) { transname.Text = po.transname.ToString(); } if (!string.IsNullOrEmpty(po.cabinno)) { cabinno.Text = po.cabinno.ToString(); } if (!string.IsNullOrEmpty(po.FriNum)) { FriNum.Text = po.FriNum.ToString(); } if (!string.IsNullOrEmpty(po.useType)) { UserType.SelectedItem.Text = po.useType.ToString(); UserType.SelectedValue = po.useTypeCode.ToString(); } if (!string.IsNullOrEmpty(po.TransportType)) { TransportType.SelectedItem.Text = po.TransportType.ToString(); TransportType.SelectedValue = po.TransportTypeCode.ToString(); } if (!string.IsNullOrEmpty(po.BusinessType)) { BusinessType.SelectedItem.Text = po.BusinessType.ToString(); BusinessType.SelectedValue = po.BusinessTypeCode.ToString(); } if (!string.IsNullOrEmpty(po.WrapType)) { WrapType.SelectedItem.Text = po.WrapType.ToString(); WrapType.SelectedValue = po.WrapTypeCode.ToString(); } if (!string.IsNullOrEmpty(po.TradeType)) { TradeType.SelectedItem.Text = po.TradeType.ToString(); TradeType.SelectedValue = po.TradeTypeCode.ToString(); } if (!string.IsNullOrEmpty(po.getTax)) { GetTax.SelectedItem.Text = po.getTax.ToString(); GetTax.SelectedValue = po.getTaxCode.ToString(); } if (!string.IsNullOrEmpty(po.applyort)) { Applyort.SelectedItem.Text = po.applyort.ToString(); Applyort.SelectedValue = po.applyortCode.ToString(); } if (!string.IsNullOrEmpty(po.ContainerNumberType)) { ContainerNumberType.SelectedItem.Text = po.ContainerNumberType.ToString(); } if (!string.IsNullOrEmpty(po.voyage)) { voyage.Text = po.voyage.ToString(); } } }
private void btnSave_Click(object sender, EventArgs e) { //if (calendarExpectedTime.SelectedDate < DateTime.Now) //{ // this.ShowMsg("预计到货时间必须大于当前时间", false); // return; //} var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } if (string.IsNullOrEmpty(txtPONumber.Text)) { this.ShowMsg("获取PO单号失败", false); return; } if (string.IsNullOrEmpty(transname.Text)) { this.ShowMsg("运输工具名称为空,请重新输入", false); return; } if (string.IsNullOrEmpty(voyage.Text)) { this.ShowMsg("航班号为空,请重新输入", false); return; } if (string.IsNullOrEmpty(cabinno.Text)) { this.ShowMsg("提运单号为空,请重新输入", false); return; } if (string.IsNullOrEmpty(FriNum.Text)) { this.ShowMsg("法定数量为空,请重新输入", false); return; } if (ContainerNumberType.SelectedItem.Text == "--请选择规格--") { this.ShowMsg("请选择规格", false); return; } if (Applyort.SelectedItem.Text == "--请选择进口口岸--") { this.ShowMsg("请选择进口口岸", false); return; } if (GetTax.SelectedItem.Text == "--请选择征免方式--") { this.ShowMsg("请选择征免方式", false); return; } if (UserType.SelectedItem.Text == "--请选择用途--") { this.ShowMsg("请选择用途", false); return; } if (TransportType.SelectedItem.Text == "--请选择运输方式--") { this.ShowMsg("请选择运输方式", false); return; } if (BusinessType.SelectedItem.Text == "--请选择业务类型--") { this.ShowMsg("请选择业务类型", false); return; } if (WrapType.SelectedItem.Text == "--请选择包装种类--") { this.ShowMsg("请选择包装种类", false); return; } if (TradeType.SelectedItem.Text == "--请选择成交方式--") { this.ShowMsg("请选择成交方式", false); return; } if (Applyort.SelectedItem.Text == "--请选择进口口岸--") { this.ShowMsg("请选择进口口岸", false); return; } PODeclareInfo PODeclareInfo = new PODeclareInfo { TransportType = TransportType.SelectedItem.Text, TransportTypeCode = Convert.ToInt32(TransportType.SelectedValue), BusinessType = BusinessType.SelectedItem.Text, BusinessTypeCode = BusinessType.SelectedValue, WrapType = WrapType.SelectedItem.Text, WrapTypeCode = Convert.ToInt32(WrapType.SelectedValue), TradeType = TradeType.SelectedItem.Text, TradeTypeCode = Convert.ToInt32(TradeType.SelectedValue), //Qty = Convert.ToDouble(Qty.Text), //Gwt=Convert.ToDouble(Gwt.Text), transname = transname.Text, cabinno = cabinno.Text, //applyNum = Convert.ToInt32(applyNum.Text), FriNum = FriNum.Text, getTax = GetTax.SelectedItem.Text, getTaxCode = Convert.ToInt32(GetTax.SelectedValue), useType = UserType.SelectedItem.Text, useTypeCode = Convert.ToInt32(UserType.SelectedValue), applyort = Applyort.SelectedItem.Text, applyortCode = Convert.ToInt32(Applyort.SelectedValue), ContainerNumberType = ContainerNumberType.SelectedItem.Text, voyage = voyage.Text }; if (Request["Id"] != null && Request["Id"].ToString() != "") { int tmpId = 0; if (int.TryParse(this.Page.Request["Id"], out tmpId)) { PODeclareInfo.id = tmpId; if (PurchaseOrderHelper.SavePODeclareInfo(PODeclareInfo)) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/POManage/POList.aspx"), true); return; } else { this.ShowMsg("该单状态不允许操作或您无权操作该单", false); } } else { this.ShowMsg("未知参数", false); } } }
private bool SavePOItem(int POId, DataTable dt, int UserId) { //导入字段检查 string strField = "商品代码,商品名称,产品条码,外箱条形码,订单数量,是否样品,生产日期,有效日期,生产批号,商品总净重(kg),商品总毛重(kg),币别,原币单价,成本价,销售价,装箱规格,箱子尺寸,箱数"; foreach (string item in strField.Split(',')) { if (!dt.Columns.Contains(item)) { this.ShowMsg("导入模板缺少字段:" + item, false); return(false); } } //获取所有币别 Name_CN DataSet dsBaseCurrency = PurchaseOrderHelper.GetBaseCurrency(); if (dsBaseCurrency == null || dsBaseCurrency.Tables.Count <= 0 || dsBaseCurrency.Tables[0].Rows.Count <= 0) { this.ShowMsg("获取币别信息错误,请重试!", false); return(false); } List <PurchaseOrderItemInfo> listInfo = new List <PurchaseOrderItemInfo>(); dt.Columns.Add("数据检查结果"); #region 检查并构造数据 foreach (DataRow dr in dt.Rows) { PurchaseOrderItemInfo purchaseOrderItemInfo = new PurchaseOrderItemInfo(); if (dr["商品代码"].ToString() == "") { dr["数据检查结果"] = "商品代码不能为空"; continue; } purchaseOrderItemInfo.SkuId = dr["商品代码"].ToString(); purchaseOrderItemInfo.POId = POId; purchaseOrderItemInfo.BoxBarCode = dr["外箱条形码"].ToString(); int tempExpectQuantity = 0; if (!int.TryParse(dr["订单数量"].ToString(), out tempExpectQuantity)) { dr["数据检查结果"] = "订单数量转换错误,请输入正确的数字"; continue; } purchaseOrderItemInfo.ExpectQuantity = tempExpectQuantity; if (dr["是否样品"].ToString() != "" && dr["是否样品"].ToString() != "是" && dr["是否样品"].ToString() != "否") { dr["数据检查结果"] = "是否样品,请输入‘是’或‘否’"; continue; } if (dr["是否样品"].ToString() != "") { purchaseOrderItemInfo.IsSample = dr["是否样品"].ToString() == "否" ? false : true; } DateTime tempManufactureDate = DateTime.MinValue; if (dr["生产日期"].ToString() != "" && !DateTime.TryParse(dr["生产日期"].ToString(), out tempManufactureDate)) { dr["数据检查结果"] = "生产日期格式错误"; continue; } if (dr["生产日期"].ToString() != "") { purchaseOrderItemInfo.ManufactureDate = tempManufactureDate; } DateTime tempEffectiveDate = DateTime.MinValue; if (dr["有效日期"].ToString() != "" && !DateTime.TryParse(dr["有效日期"].ToString(), out tempEffectiveDate)) { dr["数据检查结果"] = "有效日期格式错误"; continue; } if (dr["有效日期"].ToString() != "") { purchaseOrderItemInfo.EffectiveDate = tempEffectiveDate; } purchaseOrderItemInfo.BatchNumber = dr["生产批号"].ToString(); decimal tempNetWeight = 0; if (dr["商品总净重(kg)"].ToString() != "" && !decimal.TryParse(dr["商品总净重(kg)"].ToString(), out tempNetWeight)) { dr["数据检查结果"] = "商品总净重(kg)格式错误"; continue; } if (dr["商品总净重(kg)"].ToString() != "") { purchaseOrderItemInfo.NetWeight = tempNetWeight; } decimal tempRoughWeight = 0; if (dr["商品总毛重(kg)"].ToString() != "" && !decimal.TryParse(dr["商品总毛重(kg)"].ToString(), out tempRoughWeight)) { dr["数据检查结果"] = "商品总毛重(kg)格式错误"; continue; } if (dr["商品总毛重(kg)"].ToString() != "") { purchaseOrderItemInfo.RoughWeight = tempRoughWeight; } //需转换成Id if (dr["币别"].ToString() != "") { DataRow[] drs = dsBaseCurrency.Tables[0].Select("Name_CN='" + dr["币别"].ToString() + "'"); if (drs.Length <= 0) { dr["数据检查结果"] = "未匹配到币别,请输入系统中存在币别"; continue; } purchaseOrderItemInfo.CurrencyId = int.Parse(drs[0]["ID"].ToString()); } decimal tempOriginalCurrencyPrice = 0; if (dr["原币单价"].ToString() != "" && !decimal.TryParse(dr["原币单价"].ToString(), out tempOriginalCurrencyPrice)) { dr["数据检查结果"] = "原币单价格式错误"; continue; } if (dr["原币单价"].ToString() != "") { purchaseOrderItemInfo.OriginalCurrencyPrice = tempOriginalCurrencyPrice; } decimal tempCostPrice = 0; if (dr["成本价"].ToString() != "" && !decimal.TryParse(dr["成本价"].ToString(), out tempCostPrice)) { dr["数据检查结果"] = "成本价格式错误"; continue; } if (dr["成本价"].ToString() != "") { purchaseOrderItemInfo.CostPrice = tempCostPrice; } decimal tempSalePrice = 0; if (dr["销售价"].ToString() != "" && !decimal.TryParse(dr["销售价"].ToString(), out tempSalePrice)) { dr["数据检查结果"] = "销售价格式错误"; continue; } if (dr["销售价"].ToString() != "") { purchaseOrderItemInfo.SalePrice = tempSalePrice; } purchaseOrderItemInfo.CartonSize = dr["装箱规格"].ToString(); purchaseOrderItemInfo.CartonMeasure = dr["箱子尺寸"].ToString(); int tempCases = 0; if (dr["箱数"].ToString() != "" && !int.TryParse(dr["箱数"].ToString(), out tempCases)) { dr["数据检查结果"] = "箱数转换错误,请输入正确的数字"; continue; } if (dr["箱数"].ToString() != "") { purchaseOrderItemInfo.Cases = tempCases; } purchaseOrderItemInfo.UpdateUserId = UserId; //汇率 if (tempOriginalCurrencyPrice != 0 && tempSalePrice != 0) { purchaseOrderItemInfo.Rate = tempOriginalCurrencyPrice / tempSalePrice; } //合计价格 if (tempCostPrice != 0) { purchaseOrderItemInfo.TotalCostPrice = tempCostPrice * purchaseOrderItemInfo.ExpectQuantity; } if (tempSalePrice != 0) { purchaseOrderItemInfo.TotalSalePrice = tempSalePrice * purchaseOrderItemInfo.ExpectQuantity; } if (tempOriginalCurrencyPrice != 0) { purchaseOrderItemInfo.OriginalCurrencyTotalPrice = tempOriginalCurrencyPrice * purchaseOrderItemInfo.ExpectQuantity; } dr["数据检查结果"] = "数据无误"; listInfo.Add(purchaseOrderItemInfo); } #endregion if (listInfo != null && listInfo.Count > 0 && listInfo.Count == dt.Rows.Count) { this.ShowMsg(PurchaseOrderHelper.ImportPoItem(listInfo), true); } else { //全部提交失败 this.ShowMsg("存在数据错误,请查看错误Excel后导入", false); GetExcelReportItem(dt, "POImportError"); return(false); } return(true); }
private void btnSave_Click(object sender, System.EventArgs e) { ManagerHelper.CheckPrivilege(Privilege.POAdd); var member = HiContext.Current.User; if (member == null || member.IsLockedOut) { this.ShowMsg("获取用户信息失败,请重新登录", false); return; } if (Request["Id"] != null && Request["Id"].ToString() != "") { PurchaseOrderItemInfo purchaseOrderItemInfo = new PurchaseOrderItemInfo { BoxBarCode = txtBoxBarCode.Text, ExpectQuantity = txtExpectQuantity.Text.Length > 0 ? int.Parse(txtExpectQuantity.Text) : 0, //PracticalQuantity = txtPracticalQuantity.Text.Length > 0 ? int.Parse(txtPracticalQuantity.Text) : 0, IsSample = ddlIsSample.SelectedValue == "0" ? false : true, ManufactureDate = calendarManufactureDate.SelectedDate, EffectiveDate = calendarEffectiveDate.SelectedDate, BatchNumber = txtBatchNumber.Text, RoughWeight = txtRoughWeight.Text.Length > 0 ? decimal.Parse(txtRoughWeight.Text) : 0, NetWeight = txtNetWeight.Text.Length > 0 ? decimal.Parse(txtNetWeight.Text) : 0, OriginalCurrencyPrice = txtOriginalCurrencyPrice.Text.Length > 0 ? decimal.Parse(txtOriginalCurrencyPrice.Text) : 0, CurrencyId = int.Parse(ddlCurrency.SelectedValue), Rate = hidRate.Value.Length > 0 ? decimal.Parse(hidRate.Value) : 0,//txtRate.Text.Length > 0 ? decimal.Parse(txtRate.Text) : 0, CostPrice = txtCostPrice.Text.Length > 0 ? decimal.Parse(txtCostPrice.Text) : 0, SalePrice = txtSalePrice.Text.Length > 0 ? decimal.Parse(txtSalePrice.Text) : 0, CartonSize = txtCartonSize.Text, Cases = txtCases.Text.Length > 0 ? int.Parse(txtCases.Text) : 0, CartonMeasure = txtCartonMeasure.Text, UpdateUserId = member.UserId }; int tmpId = 0; if (int.TryParse(this.Page.Request["Id"], out tmpId)) { purchaseOrderItemInfo.id = tmpId; purchaseOrderItemInfo.TotalCostPrice = purchaseOrderItemInfo.CostPrice * purchaseOrderItemInfo.ExpectQuantity; purchaseOrderItemInfo.TotalSalePrice = purchaseOrderItemInfo.SalePrice * purchaseOrderItemInfo.ExpectQuantity; purchaseOrderItemInfo.OriginalCurrencyTotalPrice = purchaseOrderItemInfo.OriginalCurrencyPrice * purchaseOrderItemInfo.ExpectQuantity; if (PurchaseOrderHelper.EditPurchaseOrderItemInfo(purchaseOrderItemInfo)) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/POManage/POItemList.aspx?Id=" + POId + "&SupplierId=" + SupplierId), true); return; } else { this.ShowMsg("该单状态不允许操作或您无权操作该单", false); } } else { this.ShowMsg("未知参数", false); } } else { this.ShowMsg("未知参数", false); } }